package user

import org.springframework.cloud.contract.spec.Contract

Contract.make {
    request {
        method 'PUT'
        url value(consumer(regex('/api/users/\\d+/nodeBBUser')), producer('/api/users/1/nodeBBUser'))
        body("""
             {
                "userId":1,
                "username":"user",
                "password":"1234"
             }
        """)
        bodyMatchers {
            jsonPath('$.userId',byRegex(number()))
            jsonPath('$.username',byRegex("\\w+"))
            jsonPath('$.password',byRegex("\\w+"))
        }
        headers {
            header('Content-Type': 'application/json;charset=UTF-8')
        }
    }
    response {
        status 204
    }
}